/*
 * timeout.h
 *
 *  Created on: Jan 16, 2014
 *      Author: yosef
 */

#ifndef TIMEOUT_H_
#define TIMEOUT_H_

#include <sys/time.h>

class TimeOut
{
private:
    struct timeval PreviousTime;

public:

    // Constructor
    TimeOut()
	{/* Empty body. */}

    /*! \brief Reset the timer.
     * 			It writes the current time of the day in the structure PreviousTime.
     */
    void ResetTimer(void);

    /*! \brief Returns the time elapsed since initialization.
     * 			It write the current time of the day in the structure CurrentTime.
     * 			Then it returns the difference between CurrentTime and PreviousTime.
     *
     * 	@return	The number of milliseconds elapsed since the functions InitTimer was called.
     */
    unsigned long int ElapsedTime_ms(void);

    /*! \brief Returns the time elapsed since initialization.
     * 			It write the current time of the day in the structure CurrentTime.
     * 			Then it returns the difference between CurrentTime and PreviousTime.
     *
     * 	@return	The number of microseconds elapsed since the functions InitTimer was called.
     */
    unsigned long int ElapsedTime_us(void);

};



#endif /* TIMEOUT_H_ */
